package com.user_Chan.Blockchain.service;

import com.alibaba.fastjson.JSONObject;
import com.user_Chan.Blockchain.Constants;
import com.user_Chan.Blockchain.bean.TravelListCommon;
import com.user_Chan.Blockchain.bean.TravelListResult;
import com.user_Chan.Blockchain.request.Http_Utils;

import java.util.List;

/**
 * @author Chan
 * @title: TraveListService
 * @projectName C200603_Tu_Blockchain
 * @desc:
 * @date 2021/12/17 12:32 上午
 */
public class TraveListService {
    /**
     　　* @description:
     　　* @param :   查询网络热门榜单数据
     　　* @return ${return_type}
     　　* @author ${Chan}
     　　* @date 2021/12/17 12:52 上午
     　　
     * @return*/
    public List<TravelListResult> getTracel(){
        //地址                            //请求key                        //查询旅游新势力榜                    //返回条数
        String url = Constants.TRIP_URL + "?key=" + Constants.TRIP_KEY + "&type= travel_new" + "&size= 20";
        String rusl =  Http_Utils.Get(url);
//        System.out.println(rusl);
        //测试 json网络工具解析
//        "nickname":"海知鲸",   作者名
//                "follower_count":204777,     粉丝数量
//                "effect_value":778827,          点赞量
//    作者头像     "avatar":"https:\/\/p29.douyinpic.com\/aweme\/100x100\/aweme-avatar\/tos-cn-avt-0015_224b4749e9298064671a36c7621c1468.jpeg?from=2956013662"
        //作品集合   "video_list":"item_cover"，  "share_url",  "title"

        //Json解析
        TravelListCommon travelListCommon = JSONObject.parseObject(rusl, TravelListCommon.class);

        return travelListCommon.result;

    }
}
